import {natsClient} from "@/utils/nats_client";


/**
 * 订阅进入群聊房间
 * @param roomId 房间id
 * @param callback 回调方法
 */
export function subGroupChatParticipantEnter(roomId , callback){
    natsClient.sub(`$report.$rv.v1.*.groupChat.enter.${roomId}` , callback)
}


/**
 * 发布订阅进入群聊房间
 * @param roomId 房间id
 * @param publisherId 发送方id
 * @param data 发布数据
 */
export function reportGroupChatParticipantEnter(roomId ,publisherId, data){
    natsClient.pub(`$report.$rv.v1.${publisherId}.groupChat.enter.${roomId}` , data)
}

/**
 * 取消订阅进入群聊房间
 * @param roomId 房间id
 */
export function unSubGroupChatParticipantEnter(roomId){
    natsClient.unsub(`$report.$rv.v1.*.groupChat.enter.${roomId}`)
}


/**
 * 订阅进入群聊房间
 * @param roomId 房间id
 * @param participantId 参与者id
 * @param callback 回调方法
 */
export function subGroupChatParticipantWelcome(roomId , participantId, callback){
    natsClient.sub(`$report.$rv.v1.*.groupChat.welcome.${roomId}.${participantId}` , callback)
}


/**
 * 发布订阅进入群聊房间
 * @param roomId 房间id
 * @param publisherId 发送方id
 * @param participantId 参与者id
 * @param data 发布数据
 */
export function reportGroupChatParticipantWelcome(roomId , publisherId, participantId, data){
    natsClient.pub(`$report.$rv.v1.${publisherId}.groupChat.welcome.${roomId}.${participantId}` , data)
}

/**
 * 取消订阅进入群聊房间
 * @param roomId 房间id
 * @param participantId 参与者id
 */
export function unSubGroupChatParticipantWelcome(roomId , participantId){
    natsClient.unsub(`$report.$rv.v1.*.groupChat.welcome.${roomId}.${participantId}`)
}


/**
 * 订阅群聊用户发布offer
 * @param roomId 房间id
 * @param participantId 参与者id
 * @param publisherId 发送方id
 * @param callback 回调方法
 */
export function subGroupChatParticipantOffer(roomId ,publisherId, participantId, callback){
    natsClient.sub(`$report.$rv.v1.${publisherId}.groupChat.offer.${roomId}.${participantId}` , callback)
}


/**
 * 群聊用户发布offer
 * @param roomId 房间id
 * @param participantId 参与者id
 * @param data 发布数据
 * @param publisherId 发送方id
 */
export function reportGroupChatParticipantOffer(roomId , publisherId, participantId, data){
    natsClient.pub(`$report.$rv.v1.${publisherId}.groupChat.offer.${roomId}.${participantId}` , data)
}

/**
 * 取消订阅群聊房间发布offer
 * @param roomId 房间id
 * @param publisherId 发送方id
 * @param participantId 参与者id
 */
export function unSubGroupChatParticipantOffer(roomId , publisherId, participantId){
    natsClient.unsub(`$report.$rv.v1.${publisherId}.groupChat.offer.${roomId}.${participantId}`)
}


/**
 * 订阅群聊用户发布answer
 * @param roomId 房间id
 * @param publisherId 发送方id
 * @param participantId 参与者id
 * @param callback 回调方法
 */
export function subGroupChatParticipantAnswer(roomId , publisherId, participantId, callback){
    natsClient.sub(`$report.$rv.v1.${publisherId}.groupChat.answer.${roomId}.${participantId}` , callback)
}


/**
 * 群聊用户发布answer
 * @param roomId 房间id
 * @param publisherId 发送方id
 * @param participantId 参与者id
 * @param data 发布数据
 */
export function reportGroupChatParticipantAnswer(roomId , publisherId, participantId, data){
    natsClient.pub(`$report.$rv.v1.${publisherId}.groupChat.answer.${roomId}.${participantId}` , data)
}

/**
 * 取消订阅群聊房间发布answer
 * @param roomId 房间id
 * @param publisherId 发送方id
 * @param participantId 参与者id
 */
export function unSubGroupChatParticipantAnswer(roomId , publisherId, participantId){
    natsClient.unsub(`$report.$rv.v1.${publisherId}.groupChat.answer.${roomId}.${participantId}`)
}


/**
 * 订阅群聊用户发布candidate
 * @param roomId 房间id
 * @param publisherId 发送方id
 * @param participantId 参与者id
 * @param callback 回调方法
 */
export function subGroupChatParticipantCandidate(roomId , publisherId, participantId, callback){
    natsClient.sub(`$report.$rv.v1.${publisherId}.groupChat.candidate.${roomId}.${participantId}` , callback)
}


/**
 * 群聊用户发布candidate
 * @param roomId 房间id
 * @param publisherId 发送方id
 * @param participantId 参与者id
 * @param data 发布数据
 */
export function reportGroupChatParticipantCandidate(roomId , publisherId, participantId, data){
    natsClient.pub(`$report.$rv.v1.${publisherId}.groupChat.candidate.${roomId}.${participantId}` , data)
}

/**
 * 取消订阅群聊房间发布candidate
 * @param roomId 房间id
 * @param participantId 参与者id
 * @param publisherId 客户端id
 */
export function unSubGroupChatParticipantCandidate(roomId , publisherId, participantId){
    natsClient.unsub(`$report.$rv.v1.${publisherId}.groupChat.candidate.${roomId}.${participantId}`)
}


/**
 * 订阅群聊用户强制踢出
 * @param roomId 房间id
 * @param userId 用户id
 * @param callback 回调方法
 */
export function subGroupChatParticipantForceKick(roomId , userId,  callback){
    natsClient.sub(`$report.$rv.v1.*.groupChat.forceKick.${roomId}.${userId}` , callback)
}


/**
 * 发布订阅群聊用户强制踢出
 * @param roomId 房间id
 * @param userId 用户id
 * @param publisherId 发送方id
 * @param data 发布数据
 */
export function reportGroupChatParticipantForceKick(roomId ,publisherId, userId ,data){
    natsClient.pub(`$report.$rv.v1.${publisherId}.groupChat.forceKick.${roomId}.${userId}` , data)
}

/**
 * 取消订阅群聊用户强制踢出
 * @param userId 用户id
 * @param roomId 房间id
 */
export function unSubGroupChatParticipantForceKick(roomId ,userId){
    natsClient.unsub(`$report.$rv.v1.*.groupChat.forceKick.${roomId}.${userId}`)
}



/**
 * 订阅群聊用户退出
 * @param roomId 房间id
 * @param callback 回调方法
 */
export function subGroupChatParticipantExit(roomId,callback){
    natsClient.sub(`$report.$rv.v1.*.groupChat.exit.${roomId}` , callback)
}


/**
 * 发布订阅群聊用户退出
 * @param roomId 房间id
 * @param publisherId 发送方id
 * @param data 发布数据
 */
export function reportGroupChatParticipantExit(roomId ,publisherId, data){
    natsClient.pub(`$report.$rv.v1.${publisherId}.groupChat.exit.${roomId}` , data)
}

/**
 * 取消订阅群聊用户退出
 * @param roomId 房间id
 */
export function unSubGroupChatParticipantExit(roomId){
    natsClient.unsub(`$report.$rv.v1.*.groupChat.exit.${roomId}`)
}


/**
 * 订阅群聊房间解散
 * @param roomId 房间id
 * @param callback 回调方法
 */
export function subRoomDismiss(roomId,callback){
    natsClient.sub(`$report.$rv.v1.*.room.dismiss.${roomId}` , callback)
}

/**
 * 取消订阅群聊房间解散
 * @param roomId 房间id
 */
export function unSubRoomDismiss(roomId){
    natsClient.unsub(`$report.$rv.v1.*.room.dismiss.${roomId}`)
}